package com.cn.pxxy.service.Impl;

import com.cn.pxxy.Utils.MD5Utils;
import com.cn.pxxy.dao.UserDao;
import com.cn.pxxy.entity.User;
import com.cn.pxxy.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userdao;

    public List selectAll() {
        return null;
    }

    public void delete() {

    }

    public User selectById(int id) {
        User user = userdao.selectById(id);
        return user;
    }

    public void adduser() {

    }

    public void update(int id) {

    }

    public User selectLogin(String username, String upassword) {
        User user = userdao.selectByName(username);/*&&user.getPassword().equals(MD5Utils.md5(upassword))*/
        if(user!=null){
            return user;
        }
        return null;
    }
}
/*<form action="/user/login" class="form center" id="userLogin">
    <div class="login_main center">
        <div class="username">
            <div class="left fl">username:&nbsp;</div>
            <div class="right fl">
                <input class="shurukuang" type="text" name="username" placeholder="input your name"/>
                <label id="nameMsg"></label>
            </div>
        </div>
        <div class="username">
            <div class="left fl">password:&nbsp;</div>
            <div class="right fl">
                <input class="shurukuang" type="password" name="password"  placeholder="input your password"/>
            </div>
        </div>

        <div class="login_submit">
            <input class="submit" type="submit" name="submit" value="登录" id="btn" >
        </div>
        <span style="color:red">${msg}</span>
    </div>
</form>*/
